import { EquipmentType } from "core/typeDefine/typeDefine"
import { ItemModel } from "./itemModel"

export class EquipmentsModel {
    [EquipmentType.Weapon]: ItemModel
    [EquipmentType.SubWeapon]: ItemModel
    [EquipmentType.Body]: ItemModel
    [EquipmentType.Waist]: ItemModel
    [EquipmentType.Shoulder]: ItemModel
    [EquipmentType.Foot]: ItemModel
    [EquipmentType.Leg]: ItemModel
    [EquipmentType.Head]: ItemModel
    [EquipmentType.Ring]: ItemModel
    [EquipmentType.Earring]: ItemModel
    [EquipmentType.Necklace]: ItemModel
    [EquipmentType.Wings]: ItemModel
    constructor(opts: any = {}) {
        this[EquipmentType.Weapon] = opts[EquipmentType.Weapon] ? new ItemModel(opts[EquipmentType.Weapon]) : null
        this[EquipmentType.SubWeapon] = opts[EquipmentType.SubWeapon] ? new ItemModel(opts[EquipmentType.SubWeapon]) : null
        this[EquipmentType.Body] = opts[EquipmentType.Body] ? new ItemModel(opts[EquipmentType.Body]) : null
        this[EquipmentType.Foot] = opts[EquipmentType.Foot] ? new ItemModel(opts[EquipmentType.Foot]) : null
        this[EquipmentType.Head] = opts[EquipmentType.Head] ? new ItemModel(opts[EquipmentType.Head]) : null
        this[EquipmentType.Ring] = opts[EquipmentType.Ring] ? new ItemModel(opts[EquipmentType.Ring]) : null
        this[EquipmentType.Earring] = opts[EquipmentType.Earring] ? new ItemModel(opts[EquipmentType.Earring]) : null
        this[EquipmentType.Necklace] = opts[EquipmentType.Necklace] ? new ItemModel(opts[EquipmentType.Necklace]) : null
        this[EquipmentType.Wings] = opts[EquipmentType.Wings] ? new ItemModel(opts[EquipmentType.Wings]) : null
        this[EquipmentType.Waist] = opts[EquipmentType.Waist] ? new ItemModel(opts[EquipmentType.Waist]) : null
        this[EquipmentType.Shoulder] = opts[EquipmentType.Shoulder] ? new ItemModel(opts[EquipmentType.Shoulder]) : null
        this[EquipmentType.Leg] = opts[EquipmentType.Leg] ? new ItemModel(opts[EquipmentType.Leg]) : null
    }
}

export class PackagesModel {
    [EquipmentType.Weapon]: PackageModel
    [EquipmentType.SubWeapon]: PackageModel
    [EquipmentType.Body]: PackageModel
    [EquipmentType.Waist]: PackageModel
    [EquipmentType.Shoulder]: PackageModel
    [EquipmentType.Foot]: PackageModel
    [EquipmentType.Leg]: PackageModel
    [EquipmentType.Head]: PackageModel
    [EquipmentType.Ring]: PackageModel
    [EquipmentType.Earring]: PackageModel
    [EquipmentType.Necklace]: PackageModel
    [EquipmentType.Wings]: PackageModel
    constructor(opts: any = {}) {
        this[EquipmentType.Weapon] =  new PackageModel(opts[EquipmentType.Weapon]) 
        this[EquipmentType.SubWeapon] =  new PackageModel(opts[EquipmentType.SubWeapon]) 
        this[EquipmentType.Body] =  new PackageModel(opts[EquipmentType.Body])
        this[EquipmentType.Foot] =  new PackageModel(opts[EquipmentType.Foot]) 
        this[EquipmentType.Head] =  new PackageModel(opts[EquipmentType.Head]) 
        this[EquipmentType.Ring] =  new PackageModel(opts[EquipmentType.Ring]) 
        this[EquipmentType.Earring] =  new PackageModel(opts[EquipmentType.Earring]) 
        this[EquipmentType.Necklace] =  new PackageModel(opts[EquipmentType.Necklace]) 
        this[EquipmentType.Wings] = new PackageModel(opts[EquipmentType.Wings]) 
        this[EquipmentType.Waist] =  new PackageModel(opts[EquipmentType.Waist]) 
        this[EquipmentType.Shoulder] =  new PackageModel(opts[EquipmentType.Shoulder])
        this[EquipmentType.Leg] =  new PackageModel(opts[EquipmentType.Leg]) 
    }
}
export class PackageModel {
    id: number
    lock: boolean
    constructor(opts: any = {}) {
        this.id = opts.id || null
        this.lock = opts.lock || false
    }
}